﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/site.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.PhanQuyen.UsersForm>" %>

<%@ Import Namespace="Webdiyer.WebControls.Mvc"%>
<%@ Import Namespace="DONGACS.DTO"%>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript" src="<%= ResolveUrl("~/Content/Scripts/User/PermissionsAllUsers.js") %>" ></script>
<script type="text/javascript" src="<%= ResolveUrl("~/Content/Scripts/Common/DinhNghiaSoLuongSectionDongMo.js") %>"></script>
<script language="javascript" type="text/javascript" >
    $(document).ready(function () {
        selectMenu("system-SetRolesForUsers");

        $("#tabs").tabs();

        $("#UserNameSearch").focus();

    });
</script>
<%Html.BeginForm(); %>

    <input type="hidden" name="CurrentPageNumber" id="CurrentPageNumber" value="<%= Model.CurrentPageNumber %>"  />
    <input type="hidden" name="CurrentUsersId" id="CurrentUsersId" value=""  />
    <input type="hidden" name="CurrentUsersIdTemp" id="CurrentUsersIdTemp" value=""  />
    <input type="hidden" name="SearchOrPagingClickFlag" id="SearchOrPagingClickFlag"/>
    <input type="hidden" name="UsersClickFlag" id="UsersClickFlag"/>
    <input type="hidden" name="SearchFlag" id="SearchFlag" value="true"/>
    <input type="hidden" name="UpdatePermissionPerUserFlag" id="UpdatePermissionPerUserFlag" />
    <input type="hidden" name="UpdateRolesFlag" id="UpdateRolesFlag" value="false" />
    <input type="hidden" name="ResetFlag" id="ResetFlag" value="false"/>
    <input type="hidden" name="SortFlag" id="SortFlag" value="false"/>
    <input type="hidden" name="PropertySort" id="PropertySort" value=""/>
    <input type="hidden" name="Flag" id="Flag" value = '<%=Model.Flag%>'/>
    <input type="hidden" name="NewPermissionPerUserString" id="NewPermissionPerUserString"/> 
    <input type="hidden" name="NewVailableRoleIdString" id="NewVailableRoleIdString"/> 
    <input type="hidden" name="HidLastTab" id="HidLastTab" value=""/> 
    
    <%--<div class="module">--%>
    <div class="box round first fullpage">
            <h4> Gán Roles cho Người dùng</h4>
		<!-- end box / title -->

        <%--<div class="module_top"></div>--%>
         <div class="box round first grid" style="border: 1px solid #ddd ">
                <h4>
                  </h4>
        <table  class="data display datatable" style="width: 100%">                
            <tr>
                <td colspan="2" class="first" style="width: 100%">
                     Danh sách Người dùng: <span style="float: right"> <%=Html.TextBox("UserNameSearch")%>
                    <img onclick="javascript:doSearch();" style="vertical-align: middle; cursor:pointer" src="<%=ResolveUrl("~/Content/img/search_icon.gif")%>"
                        alt="Tìm theo tên đăng nhập" title="Tìm theo tên đăng nhập"/></span>
                </td>                
            </tr>
            <tr>
                <td colspan="4">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <tr class="title">
                            <td style="border: 1px solid #ddd "width="5%" class="first">
                                <strong>Mã</strong>
                            </td>
                            <td style="border: 1px solid #ddd "align="left"  nowrap="nowrap">
                                <strong><a href="javascript:doSort('Username');" >Tên đăng nhập</a></strong>
                            </td>
                            <td style="border: 1px solid #ddd "align="left" nowrap="nowrap">
                                <strong><a href="javascript:doSort('Fullname');" >Tên hiển thị</a></strong>
                            </td>
                            <td style="border: 1px solid #ddd "width="7%">
                                <strong><a href="javascript:doSort('Status');" >Trạng thái</a></strong>
                            </td>
                            <td style="border: 1px solid #ddd "align="center">
                                <strong>Role</strong>
                            </td>
                            <td style="border: 1px solid #ddd "align="center" nowrap="nowrap">
                                <strong>Permission</strong>
                            </td>
                            <td style="border: 1px solid #ddd "width="11%" align="left" nowrap="nowrap">
                                <strong>Ngày cập nhật</strong>
                            </td>
                            <td style="border: 1px solid #ddd "align="left" class="last" nowrap="nowrap"><%--class="last"--%>
                                <strong>Người cập nhật</strong>
                            </td>
                        </tr>
                        <%if (Model.UsersPagedList.Count > 0 && Model.UsersPagedList != null)
                            {
                                foreach (var dto in Model.UsersPagedList)
                                {
                        %>
                        <%if(dto.ID.ToString() == Model.CurrentUsersId)
                        {
                                %>
                                <tr class="item_row" onclick="highlight(this);javascript:onClickUsers(<%=dto.ID%>);" style="background-color:#f1f0ed">
                                <%
                        }
                            else
                        {
                            %>
                                <tr class="item_row" onclick="highlight(this);javascript:onClickUsers(<%=dto.ID%>);">
                                
                            <%
                        }%>
                           
                            <td style="border: 1px solid #ddd "class="first"><%=dto.ID %></td>                                 
                                
                            <td style="border: 1px solid #ddd ">&nbsp;<%=dto.UserName %></td>                                    
                                
                            <td style="border: 1px solid #ddd "nowrap="nowrap">&nbsp;<%=dto.LastName%>&nbsp;<%=dto.FirstName %></td>
                                
                            <td style="border: 1px solid #ddd "nowrap="nowrap">&nbsp;
                                <%
                                if (dto.IsActive)
                                {%>
                                <span style="color:blue"> Đang hoặt động</span>
                                <%}
                                        else
                                        {%>
                                <span style="color:red">Đang khóa</span>
                                <%}%>
                            </td>
                            <td style="border: 1px solid #ddd "align="center">
                                &nbsp;
                                <% if (dto.RoleExist)
                                    { %>
                                Yes
                                <%}
                                    else
                                    { %>
                                No
                                <%} %>
                            </td>
                            <td style="border: 1px solid #ddd "align="center">
                                &nbsp;
                                <% if (dto.SpecialPermission)
                                    { %>
                                Yes
                                <%}
                                    else
                                    {%>
                                No
                                <%} %>
                            </td>
                            <td style="border: 1px solid #ddd ">
                                &nbsp;<%=dto.UpdateDate.ToString("MM/dd/yyyy")%>
                            </td>
                            <td style="border: 1px solid #ddd "class="last" nowrap="nowrap">
                                &nbsp;<%=dto.UpdateByUser %>
                            </td>
                        </tr>
                        <%
                            }
                            } %>
                        <tr class="border_bottom">
                            <td class="first" style="background:#DDDDDD">&nbsp;<div style="float: left" >&nbsp;&nbsp;</div></td>
                            <td class = "last" colspan="7" align="right" style="background:#DDDDDD; padding-right:10px">
                                    <div><%= Html.Pager(Model.UsersPagedList, new PagerOptions {PageIndexParameterName = "id"}) %></div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
       </div>
        <div id="tabs">
            <ul>
                <li><a href="#fragment-2"><span><strong>Gán Role(s)</strong></span></a></li>
                <li><a href="#fragment-3"><span><strong>Gán Permission(s)</strong></span></a></li>
            </ul>               
                
            <div id="fragment-2">
                    <%
                        if (Model.UpdateRoleSatusMessage == "Cập nhật thành công !")
                    {%>
                        <br /><span style="color:Blue; text-align:center" id = "UpdateCompleteNote" ><b><%=Model.UpdateRoleSatusMessage%></b></span><br />
                    <%}
                        else if (Model.UpdateRoleSatusMessage == "Cập nhật thất bại, xin thử lại !")
                    {%>
                        <br /><span id = "UpdateNotCompleteNote" style="color:Red; text-align:center" ><b><%=Model.UpdateRoleSatusMessage%></b></span> <br />
                    <%}%>

                <div>
                    <table class="table_outsite">
                        <tr>
                            <td width="40%" align="left">
                                <strong>Roles đã gán:</strong>
                            </td>
                            <td width="10%" align="center">
                                &nbsp;
                            </td>
                            <td width="40%" align="left">
                                <strong>Roles chưa gán :</strong>
                            </td>
                        </tr>
                        <tr>
                            <td width="40%" align="left">
                            
                                <%=Html.DropDownList("AvaiableRoles", Model.AvaiableRolesList, new { @size = "10", Style = "width:100%; background-color:#f0f0f0; border-collapse:collapse", @multiple = "multiple" })%>
                            </td>
                            <td width="10%" align="center" valign="middle">
                                <div>
                                    <input type="button" class="Button1" value="<<<" onclick="onAssign();" />
                                    <br /><br/>
                                    <input type="button" class="Button1" value=">>>" onclick="onNotAssign();" />
                                </div>
                            </td>
                            <td width="40%" align="left">
                                <%=Html.DropDownList("NotAssignedRoles", Model.NotAssignedRolesList, new { @size = "10", Style = "width:100%; background-color:#f0f0f0; border-collapse:collapse", @multiple = "multiple" })%>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" align="right">
                                <input type="button" value="Cập nhật" class="btn btn-grey"onclick="onUpdateRoleForUser();"/>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div id="fragment-3">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_module">                        
                    <tr>
                        <td style="vertical-align:top" id="NoteMessage2">
                            <%
                                if (Model.UpdateSatusMessage == "Cập nhật thành công !")
                            {%>
                                <br /><div id = "UpdatePermissionsCompleteNote" style="color:Blue;"  ><b><%=Model.UpdateSatusMessage%></b></div><br />
                            <%}
                                else if (Model.UpdateSatusMessage == "Cập nhật thất bại, xin thử lại !")
                            {%>
                                <br /><div id = "UpdatePermissionsNotCompleteNote" style="color:Red;" ><b><%=Model.UpdateSatusMessage %></b></div> <br />
                            <%}%>
                        </td>
                        <td width="30%" align="right">                            
                            <input type="button" value="Cập nhật" class="btn btn-grey"onclick="onUpdatePermissionsForUser();" />
                            <input type="reset" value="Hủy thay đổi"class="btn btn-grey"/>
                        </td>
                    </tr>
                </table>
                
                <%--Chia hệ thống phân quyền thành từng block một--%>
                
                <%
                
                for (int d = 0; d < Model.Blocks.Count; d++ )
                {
                %>
                
                <p style="margin:0px 0px 10px 40px"><b>Phân quyền : <%=Model.Blocks[d].ToUpper()%> &nbsp;</b></p>
                <div id="arrow<%=d + 1 %>" class="background_arrow_up arrow" style="float: left; cursor: pointer;clear: both; margin-top: -32px; margin-right:0px"></div>
                <div id="open_close<%=d + 1 %>" class="bo" style="width: 100%; border: 1px; margin-left: 0%; margin-bottom: 15px;">
               
                <table border="1" style="border-collapse:collapse;width: 100%" cellspacing="0" cellpadding="0">
                    <tr class="title">
                        <td style="border: 1px solid #ddd "class="first">
                            &nbsp;<b>Chức năng</b>
                        </td>
                        <td style="border: 1px solid #ddd "width="21%" align="center" nowrap="nowrap">
                            &nbsp;<b>Create/Edit/Update</b>
                        </td>
                        <td style="border: 1px solid #ddd "width="13%" align="center"  nowrap="nowrap">
                            &nbsp;<b>View/List</b>
                        </td>
                        <td style="border: 1px solid #ddd "width="11%" align="center" nowrap="nowrap">
                            &nbsp;<b>Delete</b>
                        </td>
                        <td style="border: 1px solid #ddd "width="11%" align="center" class="last" nowrap="nowrap">
                            &nbsp;<b>Execute</b>
                        </td>
                    </tr>                      
                        
                    <%
                    
                    
                    
                    for (int i = 0; i < Model.ModulesByBlockArray[d].Count; i++)
                    {
                        if (i == Model.ModulesByBlockArray[d].Count - 1)
                          {
                            %>
                            <tr onclick=" doClickCheckbox();"  class="border_bottom"></tr>
                        <%
                    }
                          else
                          {%>
                        <tr onclick=" doClickCheckbox();" >
                        <%
                    }%>
                            <td style="border: 1px solid #ddd ">&nbsp;<%=Model.ModulesByBlockArray[d][i]%></td>
                                
                                
                            <%--Case1 : Permission : Create/Edit/Update | Build CheckBox--%>                            
                            <%
                    bool checkBoxFlag1 = false;
                    for (int j = 0; j < Model.PathsList.Count; j++)
                    {
                        if ((Model.PathsList[j].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsList[j].PermissionType == "Create_Edit_Update"))
                        {
                            checkBoxFlag1 = true;
                            bool checkedFlag = false;
                            for (int k = 0; k < Model.PathsForUserList.Count; k++)
                            {
                                if ((Model.PathsForUserList[k].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsForUserList[k].PermissionType == "Create_Edit_Update"))
                                {%>
                                            <td align="center" style="border: 1px solid #ddd "><input id="<%=Model.ModulesByBlockArray[d][i] + "-" + Model.PathsForUserList[k].PermissionType%>" type="checkbox" value="<%=Model.PathsForUserList[k].ID %>" checked="checked" onclick="unSelectCreate('<%=Model.ModulesByBlockArray[d][i]%>','<%=Model.PathsForUserList[k].PermissionType %>');" />&nbsp;</td>
                                        <%
                    checkedFlag = true;
                    break;
                                }
                            }

                            if (checkedFlag == false)
                            {%>
                                        <td align="center"style="border: 1px solid #ddd "><input id="<%=Model.ModulesByBlockArray[d][i]+ "-Create_Edit_Update"%>" type="checkbox" value="<%=Model.PathsList[j].ID %>" onclick="unSelectCreate('<%=Model.ModulesByBlockArray[d][i]%>','/Create_Edit_Update');" />&nbsp;</td>
                                    <%}
                            break;
                        }
                    }
                    if (checkBoxFlag1 == false)
                    {
                                %>
                                <td align="center"style="border: 1px solid #ddd ">&nbsp;</td>
                                <%
                    }
                                
                            %>
                                
                            <%--Case2 : Permission : View/List | Build CheckBox--%>
                            <%
                    bool checkBoxFlag2 = false;
                    for (int j1 = 0; j1 < Model.PathsList.Count; j1++)
                    {
                        if ((Model.PathsList[j1].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsList[j1].PermissionType == "View_List"))
                        {
                            checkBoxFlag2 = true;
                            bool checkedFlag = false;
                            for (int k1 = 0; k1 < Model.PathsForUserList.Count; k1++)
                            {
                                if ((Model.PathsForUserList[k1].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsForUserList[k1].PermissionType == "View_List"))
                                {%>
                                            <td align="center"style="border: 1px solid #ddd "><input id ="<%=Model.ModulesByBlockArray[d][i] + "-" + Model.PathsForUserList[k1].PermissionType%>" value="<%=Model.PathsForUserList[k1].ID %>" type="checkbox" checked="checked" onclick="unSelectView('<%=Model.ModulesByBlockArray[d][i] %>','<%=Model.PathsForUserList[k1].PermissionType %>');" />&nbsp;</td>
                                        <%
                    checkedFlag = true;
                    break;
                                }
                            }

                            if (checkedFlag == false)
                            {%>
                                        <td align="center"style="border: 1px solid #ddd "><input id="<%=Model.ModulesByBlockArray[d][i]+ "-View_List"%>" value = "<%=Model.PathsList[j1].ID %>" type="checkbox" onclick="unSelectView('<%=Model.ModulesByBlockArray[d][i] %>','/View_List');" />&nbsp;</td>
                                    <%}
                            break;
                        }
                    }
                    if (checkBoxFlag2 == false)
                    {
                                %>
                                <td align="center"style="border: 1px solid #ddd ">&nbsp;</td>
                                <%
                    }    
                            %>
                                
                            <%--Case3 : Permission : Delete | Build CheckBox--%>
                            <%
                    bool checkBoxFlag3 = false;
                    for (int j2 = 0; j2 < Model.PathsList.Count; j2++)
                    {
                        if ((Model.PathsList[j2].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsList[j2].PermissionType == "Delete"))
                        {
                            checkBoxFlag3 = true;
                            bool checkedFlag = false;
                            for (int k2 = 0; k2 < Model.PathsForUserList.Count; k2++)
                            {
                                if ((Model.PathsForUserList[k2].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsForUserList[k2].PermissionType == "Delete"))
                                {%>
                                            <td align="center"style="border: 1px solid #ddd "><input id = "<%=Model.ModulesByBlockArray[d][i] + "-" + Model.PathsForUserList[k2].PermissionType %>" type="checkbox" value="<%=Model.PathsForUserList[k2].ID %>" checked="checked" onclick="unSelectDelete('<%=Model.ModulesByBlockArray[d][i] %>','<%=Model.PathsForUserList[k2].PermissionType %>');" />&nbsp;</td>
                                        <%
                    checkedFlag = true;
                    break;
                                }
                            }

                            if (checkedFlag == false)
                            {%>
                                        <td align="center"style="border: 1px solid #ddd "><input id="<%=Model.ModulesByBlockArray[d][i] + "-Delete"%>" type="checkbox" value="<%=Model.PathsList[j2].ID %>" onclick="unSelectDelete('<%=Model.ModulesByBlockArray[d][i] %>','/Delete');" />&nbsp;</td>
                                    <%}
                            break;
                        }
                    }
                    if (checkBoxFlag3 == false)
                    {
                                %>
                                <td align="center"style="border: 1px solid #ddd ">&nbsp;</td>
                                <%
                    }       
                            %>
                            
                            <%--Case4 : Permission : Execute Ngoài Thực thi một thao tác nào đó ngoài( Create/Edit/Update ; view/List ; Delete) | Build CheckBox--%>
                                <%
                    bool checkBoxFlag4 = false;
                    for (int j3 = 0; j3 < Model.PathsList.Count; j3++)
                    {
                        if ((Model.PathsList[j3].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsList[j3].PermissionType == "Execute"))
                        {
                            checkBoxFlag4 = true;
                            bool checkedFlag = false;
                            for (int k = 0; k < Model.PathsForUserList.Count; k++)
                            {
                                if ((Model.PathsForUserList[k].Modules == Model.ModulesByBlockArray[d][i]) && (Model.PathsForUserList[k].PermissionType == "Execute"))
                                {%>
                                <td align="center"style="border: 1px solid #ddd ">
                                    <input id="<%=Model.ModulesByBlockArray[d][i] + "-" + Model.PathsForUserList[k].PermissionType %>"
                                        type="checkbox" value="<%=Model.PathsForUserList[k].ID %>" checked="checked"/>&nbsp;
                                </td>
                                <%
                    checkedFlag = true;
                    break;
                                }
                            }

                            if (checkedFlag == false)
                            {%>
                                <td align="center"style="border: 1px solid #ddd ">
                                    <input id="<%=Model.ModulesByBlockArray[d][i] + "-Execute"%>" type="checkbox" value="<%=Model.PathsList[j3].ID %>"
                                        onclick="unSelectDelete('<%=Model.ModulesByBlockArray[d][i] %>','-Delete');" />&nbsp;
                                </td>
                                <%}
                            break;
                        }
                    }
                    if (checkBoxFlag4 == false)
                    {
                                %>
                                <td align="center"style="border: 1px solid #ddd ">
                                    &nbsp;
                                </td>
                                <%
                    }
                                %>
                                
                        </tr>  
                    <%
                    } // end vòng For cho Module
                    
                    %>    
         
                </table>
                
                </div>
                <br/>
                
                <%
                    }//end Vòng For cho Block
                %>

                <table cellspacing="0" cellpadding="0" class="table_module">                        
                    <tr>
                        <td align="left" id="NoteMessage1">
                            <%
                                if (Model.UpdateSatusMessage == "Cập nhật thành công !")
                            {%>
                                <br /><div id = "Span1" style="color:Blue;"><b><%=Model.UpdateSatusMessage%></b></div><br />
                            <%}
                                else if (Model.UpdateSatusMessage == "Cập nhật thất bại, xin thử lại !")
                            {%>
                                <br /><div id = "Span2" style="color:Red;"><b><%=Model.UpdateSatusMessage %></b></div> <br />
                            <%}%>
                        </td>
                        <td width="30%" align="right">
                            <input type="button" value="Cập nhật" onclick="onUpdatePermissionsForUser();"class="btn btn-grey"  />
                            <input type="reset" value="Hủy thay đổi"class="btn btn-grey" />
                        </td>
                    </tr>
                </table>

        </div>          
    </div>          
   </div>
       
<%Html.EndForm(); %>
    
    

 <script type="text/javascript" >   
                
        $(document).ready(function() {
            $("#tabs").tabs('select', <%=Model.HidLastTab%>);
            
            
        });


        function onClickUsers(currentUsersId) {

            document.getElementById("UsersClickFlag").value = true;

        //   var $tabs = $('#tabs').tabs();
       //     var selected = $tabs.tabs('option', 'selected'); // => 0
       ///    document.getElementById("HidLastTab").value = selected;
            document.getElementById("CurrentPageNumber").value = '<%=Model.CurrentPageNumber%>';
            document.getElementById("Flag").value = '<%=Model.Flag%>';
            document.getElementById("CurrentUsersId").value = currentUsersId;
            document.getElementById("CurrentUsersIdTemp").value = currentUsersId;
            document.forms[0].action = '<%=ResolveUrl("~/Users/ManageUsersWithRolesUpdate/")%>';
            document.forms[0].method = "post";
            document.forms[0].submit();
        }


        function onUpdateRoleForUser() {
            var roleIdList = "";
            for (var i = 0; i < document.getElementById("AvaiableRoles").length; i++) {
                roleIdList = roleIdList + "|" + document.getElementById("AvaiableRoles").options[i].value;
            }

            document.getElementById("NewVailableRoleIdString").value = roleIdList;

            var $tabs = $('#tabs').tabs();
            var selected = $tabs.tabs('option', 'selected'); // => 0
            document.getElementById("HidLastTab").value = selected;

            document.getElementById("CurrentUsersId").value = '<%=Model.CurrentUsersId %>';
            document.getElementById("CurrentUsersIdTemp").value = '<%=Model.CurrentUsersId %>';
            document.getElementById("UpdateRolesFlag").value = true;
            document.forms[0].action = '<%=ResolveUrl("~/Users/ManageUsersWithRolesUpdate/")%>';
            document.forms[0].method = "Post";
            document.forms[0].submit();
        }
        
        function onUpdatePermissionsForUser() {
            for (var i = 0; i < document.forms[0].length; i++) {
                var e = document.forms[0].elements[i];
                if (e.type == 'checkbox' && e.checked) {
                    document.getElementById("NewPermissionPerUserString").value = document.getElementById("NewPermissionPerUserString").value + "|" + e.id;
                }
            }
            
            var $tabs = $('#tabs').tabs();
            var selected = $tabs.tabs('option', 'selected'); // => 0
            document.getElementById("HidLastTab").value = selected;           
            

            document.getElementById("CurrentUsersId").value = '<%=Model.CurrentUsersId %>';
            document.getElementById("CurrentUsersIdTemp").value = '<%=Model.CurrentUsersId %>';
            document.getElementById("CurrentPageNumber").value = '<%=Model.CurrentPageNumber%>';
            document.getElementById("UpdatePermissionPerUserFlag").value = true;
            document.forms[0].action = '<%=ResolveUrl("~/Users/ManageUsersWithRolesUpdate/")%>';
            document.forms[0].method = "Post";
            document.forms[0].submit();
        }    
          
        function onAssign() {
            $('#NotAssignedRoles :selected').each(function(i, selected) {
                var value = $(selected).val();
                var text = $(selected).text();
                var index = $(selected).index();

                document.getElementById("NotAssignedRoles").options[index] = null;
                document.getElementById("AvaiableRoles").options[document.getElementById("AvaiableRoles").length] = new Option(text, value);

                if (document.getElementById("UpdateCompleteNote") != null) {
                    document.getElementById('UpdateCompleteNote').innerHTML = "";
                }
                if (document.getElementById("UpdateNotCompleteNote") != null) {
                    document.getElementById('UpdateNotCompleteNote').innerHTML = "";
                }
            });
        }


        function onNotAssign() {

            $('#AvaiableRoles :selected').each(function(i, selected) {
                var value = $(selected).val();
                var text = $(selected).text();
                var index = $(selected).index();

                document.getElementById("AvaiableRoles").options[index] = null;
                document.getElementById("NotAssignedRoles").options[document.getElementById("NotAssignedRoles").length] = new Option(text, value);
                if (document.getElementById("UpdateCompleteNote") != null) {
                    document.getElementById('UpdateCompleteNote').innerHTML = "";
                }

                if (document.getElementById("UpdateNotCompleteNote") != null) {
                    document.getElementById('UpdateNotCompleteNote').innerHTML = "";
                }
            });
        }        
        function doClickCheckbox() {
        document.getElementById('NoteMessage1').innerHTML = "";
        document.getElementById('NoteMessage2').innerHTML = "";
    } 
        
    

    
</script>



</asp:Content>
